package com.kaibes.admin.user;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kaibes.module.user.UserUtils;
import com.kaibes.web.admin.AdminMenu;
import com.kaibes.web.admin.AdminMenuRes;
import com.kaibes.web.thymeleaf.ThymeleafConfig;

@Configuration
public class UserInit implements InitializingBean {
    
    public final static String KEY = "user-info-manage";
    @Autowired
    private ThymeleafConfig webConfig;
    @Autowired
    private UserUtils userUtils;
    
    @Bean
    public AdminMenu userInfoMenu() {
        AdminMenu menu = new AdminMenu();
        menu.setKey(KEY);
        menu.setName("用户管理");
        menu.setIcon("fas fa-users-cog");
        menu.setHref("/admin/user");
        menu.setSort(3);
        menu.setParentKey(AdminMenuRes.MENU_USER);
        return menu;
    }

	@Override
	public void afterPropertiesSet() throws Exception {
		webConfig.putStaticVariable("userUtils", userUtils);
	}
    
}
